﻿<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/plugin/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>
<!-- 富文本js和样式  -->
<script type="text/javascript"
	src="${path }/resource/plugin/kindeditor/kindeditor.js"></script>
<link rel="stylesheet" type="text/css"
	href="${path }/resource/plugin/kindeditor/themes/default/default.css">
<!-- 文件上传需要的样式 -->

<link rel="stylesheet"
	href="${path }/resource/plugin/kindeditor/themes/default/default.css" />
<link rel="stylesheet"
	href="${path }/resource/plugin/kindeditor/plugins/code/prettify.css" />
<script src="${path }/resource/plugin/kindeditor/kindeditor.js"></script>
<script src="${path }/resource/plugin/kindeditor/lang/zh_CN.js"></script>
<script
	src="${path }/resource/plugin/kindeditor/plugins/code/prettify.js"></script>

</head>
<body>
<div class="ibox-content">
		<form class="form-horizontal" id="dataform"
			onsubmit="javascripr:return false;">
		<c:if test="${obj ne null }">
			<input type="hidden" name="adId" value="${obj.adId }">
		</c:if>
		<div class="form-group">
			<label class="col-sm-2 control-label">所属栏目<span class="text-danger">*</span></label>
			<div class="col-sm-3">
				<select class="select2 form-control autoFull" data-filed="colName" data-value="colId" name="adColumn" 
					data-url="${path}/admin/webAdcolumn/all" datatype="*" nullmsg="所属栏目不能为空"
					data-def="${obj.adColumn}">
					<option value="">-- 请选择所属栏目 --</option>
				</select>
			</div>
			<div class="Validform_checktip"></div>
			<label class="col-sm-2 control-label">广告词</label>
			<div class="col-sm-3">
				<input type="text" class="form-control" name="adTitle"
					value="${obj.adTitle }">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">排序</label>
			<div class="col-sm-3">
				<input type="text" class="form-control" name="adSequence"
				ignore="ignore"
					value="${obj.adSequence }" datatype="n1-10" nullmsg="排序不能为空" errormsg="序号只能为长度小于10位的数字">
			</div>
<label class="col-sm-2 control-label">链接地址</label>
			<div class="col-sm-3">
			<c:choose>
			<c:when test="${obj ne null }">
			<input value="${obj.adUrl}" datatype="*1-1000" id="adUrl"
					ignore="ignore" name="adUrl" class="form-control" type="text">
			</c:when>
			<c:otherwise>
			<input value="http://" datatype="*1-1000" id="adUrl"
					ignore="ignore" name="adUrl" class="form-control" type="text">
			</c:otherwise>
			</c:choose>
			
		</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">其他描述</label>
			<div class="col-sm-9">
				<textarea   class="form-control" name="adInfo1"
					 >${obj.adInfo1 }</textarea>
			</div>
			</div>

		<div class="form-group">
			<label class="col-sm-2 control-label">上传图片</label>
			<div class="col-sm-9">
				<input onclick="MTools.chooesFile('#fileText')"
					class="input-text upload-url radius form-control" style="width: 30%;display: inline;"
					type="text" id="showFileName" readonly="readonly" value="${obj.adImg}"> 
					<a onclick="MTools.chooesFile('#fileText')" class="btn btn-primary radius"> 
					<i class="fa fa-cloud-upload"></i> 浏览文件 </a> 
					<!-- <input type="button" class='btn btn-primary radius'
						onclick="MTools.upFile('#submitBtn')" value="上传">  -->
					<a id="selectInServices" class="btn btn-primary radius"> 
					<i class="fa fa-cloud"></i> 远程图库
				</a>
			</div>
		</div>

		<div class="form-group">
			<div class="col-sm-2 control-label"></div>
			<div class="col-sm-9">
				<c:if test="${obj ne null }">
					<input type="hidden" value="${obj.adImg }" name="adImg"
						id="hiddenImg" />
					<img width="150" id='img_1' src="${obj.adImg }" />
				</c:if>
				<c:if test="${obj eq null }">
					<input type="hidden" name="adImg" id="hiddenImg" />
					<img width="150" id='img_1' style="display: none" />
				</c:if>
			</div>
		</div>

		<div class="form-group ">
				<div class="col-sm-12 text-center">
				<a href="javascript:;" onclick="myForm.submit()"
					class="btn btn-success radius"><i class="fa fa-check"></i>  保存</a>&nbsp;&nbsp;&nbsp;&nbsp; <a
					 class="btn btn-danger radius" href="javascript:;" onclick="MTools.closeForm()" ><i class="fa fa-close"></i> 关闭</a>
			</div>
			</div>
	</form>
	</div>
	
	<form class="form form-horizontal" method="post" style="display: none;"
		enctype="multipart/form-data" target="blankFrame"
		action="${path }/resource/plugin/kindeditor/upload_json.jsp?dir=image&flag=img_1&hiddenImg=hiddenImg">
		<input id="fileText" type="file" multiple name="file-1"
			onchange="MTools.selectFile('#showFileName','#fileText','#submitBtn')" /> <input
			type="submit" id="submitBtn"
			onclick="MTools.upolad('img_1','file_1')" />
	</form>
	<iframe src="" name="blankFrame" id="blankFrame"
		style="height: 100px; width: 100px; display: none;"> </iframe>
	
	
	
</body>
<script type="text/javascript"
	src="${path }/resource/js/systools/MJsBase.js"></script>
	<script type="text/javascript">
	MTools.autoFullSelect();
	var myForm=MForm.initForm({
		invokeUrl:"${path}/admin/webAd/addOrModify",
		afterSubmit:function(){
			parent.myGrid.serchData();
		},
	});
	$(".select2").select2();
	
	MUI.openServiceImgSpace(function(url) {
		$("#img_1").attr("src", url).show();
		$("#hiddenImg").val(url);
		//$("#submitBtn").trigger("click");
	}, "#selectInServices");
	
	
	
	</script>
</body>
</html>